Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
Walkthrough이 변경사항은 커뮤니티 페이지를 인증된 경로로 추가하고 관련된 인증 흐름을 재구성합니다. 미들웨어에서 "/community" 경로를 로그인 필수 페이지 목록에 포함시키고, 커뮤니티 경로로의 리다이렉트 시 고정된 reason 매개변수(community-members-only)를 설정합니다. LoginContent 컴포넌트는 이 reason 매개변수를 감지하여 한 번의 토스트 메시지를 표시한 후 현재 경로로 리다이렉트합니다. 로그인 후 최종 목적지는 원래 URL 대신 항상 "/"로 변경되었습니다. Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 상세 변경 사항
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
apps/web/AUTHENTICATION.md (1)
51-60: 1. 코드 예시와 실제 구현 불일치문서의 코드 예시가 실제 구현과 약간 다릅니다. 실제
LoginContent.tsx에서는hasShownCommunityOnlyToastref를 사용하여 토스트 중복 표시를 방지하는데, 문서에는 이 가드가 생략되어 있습니다.문서의 목적이 개략적인 흐름 설명이라면 현재 상태도 괜찮지만, 정확한 구현을 반영하려면 ref 가드도 포함하는 것이 좋습니다.
📝 더 정확한 코드 예시 제안
```typescript // apps/web/src/app/login/LoginContent.tsx +const hasShownCommunityOnlyToast = useRef(false); + useEffect(() => { const reason = searchParams.get("reason"); - if (reason === "community-members-only") { + if (reason === "community-members-only" && !hasShownCommunityOnlyToast.current) { + hasShownCommunityOnlyToast.current = true; toast.info("커뮤니티는 회원 전용입니다. 로그인 후 이용해주세요."); router.replace(pathname); } }, [pathname, router, searchParams]); ```🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/AUTHENTICATION.md` around lines 51 - 60, Update the example in LoginContent.tsx to match the real implementation by adding the hasShownCommunityOnlyToast ref guard: declare hasShownCommunityOnlyToast (useRef(false)) above the useEffect, and inside the useEffect check reason === "community-members-only" && !hasShownCommunityOnlyToast.current, set hasShownCommunityOnlyToast.current = true before calling toast.info and router.replace(pathname) so the toast is shown only once; keep the rest of the logic using searchParams, toast.info, router.replace, and pathname unchanged.apps/web/src/app/login/LoginContent.tsx (1)
24-24: 1. 상수 중복 정의 문제
COMMUNITY_LOGIN_REASON상수가middleware.ts와LoginContent.tsx두 파일에서 각각 독립적으로 정의되어 있습니다. 한 파일에서 값이 변경되면 다른 파일과의 동기화가 깨질 수 있어 유지보수 위험이 있습니다.공유 상수 파일로 추출하는 것을 권장드립니다:
- 예:
apps/web/src/constants/auth.ts에 정의 후 양쪽에서 import♻️ 공유 상수 파일 생성 제안
새 파일
apps/web/src/constants/auth.ts생성:export const COMMUNITY_LOGIN_REASON = "community-members-only";그 후 양쪽 파일에서 import:
-const COMMUNITY_LOGIN_REASON = "community-members-only"; +import { COMMUNITY_LOGIN_REASON } from "@/constants/auth";🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@apps/web/src/app/login/LoginContent.tsx` at line 24, COMMUNITY_LOGIN_REASON is defined in both LoginContent.tsx and middleware.ts causing duplication; extract it into a single shared constant (e.g., create a new constant file like constants/auth.ts exporting COMMUNITY_LOGIN_REASON) and update both LoginContent.tsx and middleware.ts to import COMMUNITY_LOGIN_REASON from that module so both files reference the same source of truth.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@apps/web/AUTHENTICATION.md`:
- Around line 51-60: Update the example in LoginContent.tsx to match the real
implementation by adding the hasShownCommunityOnlyToast ref guard: declare
hasShownCommunityOnlyToast (useRef(false)) above the useEffect, and inside the
useEffect check reason === "community-members-only" &&
!hasShownCommunityOnlyToast.current, set hasShownCommunityOnlyToast.current =
true before calling toast.info and router.replace(pathname) so the toast is
shown only once; keep the rest of the logic using searchParams, toast.info,
router.replace, and pathname unchanged.
In `@apps/web/src/app/login/LoginContent.tsx`:
- Line 24: COMMUNITY_LOGIN_REASON is defined in both LoginContent.tsx and
middleware.ts causing duplication; extract it into a single shared constant
(e.g., create a new constant file like constants/auth.ts exporting
COMMUNITY_LOGIN_REASON) and update both LoginContent.tsx and middleware.ts to
import COMMUNITY_LOGIN_REASON from that module so both files reference the same
source of truth.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: 94e49dcc-56a9-4336-9bb6-5da96a05c351
📒 Files selected for processing (3)
apps/web/AUTHENTICATION.mdapps/web/src/app/login/LoginContent.tsxapps/web/src/middleware.ts
작업 내용
/community및 하위 경로에 접근하면 로그인 페이지로 리다이렉트되도록 변경했습니다.커뮤니티는 회원 전용입니다. 로그인 후 이용해주세요.안내 토스트가 1회 표시되도록 추가했습니다.특이 사항
/를 유지합니다.NEXT_PUBLIC_COOKIE_LOGIN_ENABLED=true일 때만 미들웨어에서 동작합니다.